/*
 * Alloy Analyzer
 * Copyright (c) 2002 Massachusetts Institute of Technology
 *
 * The Alloy Analyzer is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The Alloy Analyzer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the Alloy Analyzer; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package alloy.bool;
import java.io.File;

/** BLPSolverCommands: a class that generates PSolver Protocol messages
    For each type of message it has a method that takes the appropriate
    arguments and creates the string with the PSolver Protocol message
*/

public class BLPSolverCommands {
    private static final String _solverMessageStart = "<<<";
    private static final String _solverMessageEnd = ">>>";
	
    private static String makeMessage (String innerMessage_) {
	// wrap the message with the start/end sequence
	return new String (_solverMessageStart + " " + innerMessage_ + " " + _solverMessageEnd);
    }
    
    public static String quit () {
	// generate the quit command
	return makeMessage ("< user_quit >");
    }
    
    public static String solve (File problemFileHandle_, File solutionFileHandle_, int timeoutInterval_, int progressInterval_, boolean saveState_) {
    	// TODO: make sure this works -- DFR
	// generate the solve command
	return makeMessage (new String ("< user_solve < default < " + problemFileHandle_ + " " + 0 + " " + solutionFileHandle_ + " " + timeoutInterval_ + " " + progressInterval_ + " " + (saveState_ ? 1 : 0) + " > > >"));
    }

    public static String next (int clientId_) {
	// generate the next command
	return makeMessage (new String ("< user_next < clientId " + clientId_ + " > >"));
    }

    public static String cancel (int clientId_) {
	// generate the cancel command
	return makeMessage ( new String ("< user_cancel < clientId " + clientId_ + " > >"));
    }
}

    
    
